package net.entelijan.cobean.examples.lit;

import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;

public class MainFrame extends JFrame {

	private static final long serialVersionUID = 1L;

	private AuthorListPanel authorListPanel = new AuthorListPanel();
	private BookListPanel bookListPanel = new BookListPanel();

	public MainFrame() {
		super();
		setTitle("Cobean Lit");
		setSize(600, 600);
		setIconImage(new ImageIcon(getClass().getClassLoader().getResource(
				"logo-small.png")).getImage());
		Container cp = getContentPane();
		cp.setLayout(new BorderLayout());
		JTabbedPane tp = new JTabbedPane();
		tp.add(this.bookListPanel, "Books");
		tp.add(this.authorListPanel, "Authors");
		cp.add(createTop(), BorderLayout.NORTH);
		cp.add(tp, BorderLayout.CENTER);
	}

	private JLabel createTop() {
		JLabel re = new JLabel();
		re.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
				"logo-lit.png")));
		re.setOpaque(false);
		return re;
	}

	public AuthorListPanel getAuthorListPanel() {
		return this.authorListPanel;
	}

	public void setAuthorListPanel(AuthorListPanel authorListPanel) {
		this.authorListPanel = authorListPanel;
	}

	public BookListPanel getBookListPanel() {
		return this.bookListPanel;
	}

	public void setBookListPanel(BookListPanel bookListPanel) {
		this.bookListPanel = bookListPanel;
	}

}
